home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GFXFX2.ZIP / VIEWSCI1.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  1KB  |  42 lines

  1.  
  2. program viewsci; { VIEWSCI1.PAS }
  3. { Display raw picture in mode-x (320x200x256x4), by Bas van Gaalen }
  4. uses dos,u_vga,u_pal,u_mdx,u_kb;
  5. const pal_offset=$000a; pic_offset=$030a;
  6. var p_file:file;
  7.  
  8. procedure error(err:string); begin writeln(#10#13,err); halt(1); end;
  9.  
  10. procedure initfile(filename:pathstr); { check and open file }
  11. begin
  12.   if filename='' then error('Enter raw-picture filename on commandline.');
  13.   assign(p_file,filename);
  14.   {$i-} reset(p_file,1); {$i+}
  15.   if ioresult<>0 then error(fexpand(filename)+' not found.');
  16. end;
  17.  
  18. procedure displayrawpic(xpos,ypos:word);
  19. var pal:pal_type; rawbuf:pointer;
  20. begin
  21.   mdx_setmodex(mdx_320x240,320);
  22.   seek(p_file,pal_offset);
  23.   blockread(p_file,pal,$300);
  24.   setpal(pal);
  25.   getmem(rawbuf,320*200);
  26.   seek(p_file,pic_offset);
  27.   blockread(p_file,rawbuf^,320*200); { assuming a correct picture: 320x200 }
  28.   close(p_file);
  29.   mdx_displaypic(xpos,ypos,rawbuf,320,200);
  30.   freemem(rawbuf,320*200);
  31.   usefont:=font8x8;
  32.   mdx_writetxt(paramstr(1),(320-8*length(paramstr(1))) div 2,210,250);
  33. end;
  34.  
  35. begin
  36.   if maxavail<(2*320*200) then error('Out of memory.');
  37.   initfile(paramstr(1));
  38.   displayrawpic(0,0);
  39.   waitkey(0);
  40.   setvideo(u_lm);
  41. end.
  42.